home *** CD-ROM | disk | FTP | other *** search
/ AI Game Programming Wisdom / AIGameProgrammingWisdom.iso / SourceCode / 06 General Architectures / 02 McLean / Listing1.cpp next >
Encoding:
Text File  |  2001-12-09  |  759 b   |  30 lines

  1. /* Copyright (C) Alex McLean, 2001. 
  2.  * All rights reserved worldwide.
  3.  *
  4.  * This software is provided "as is" without express or implied
  5.  * warranties. You may freely copy and compile this source into
  6.  * applications you distribute provided that the copyright text
  7.  * below is included in the resulting source code, for example:
  8.  * "Portions Copyright (C) Alex McLean, 2001"
  9.  */
  10.  
  11. // A simple initial AI loop might look something like the following:
  12.  
  13. CGame::UpdateAI()
  14. {
  15.     CCharacter *pChar = GetFirstCharacter();
  16.     while( pChar )
  17.     {
  18.         pChar->ProcessAI();
  19.         pChar = pChar->GetNext();
  20.     }
  21. }
  22.  
  23. CCharacter::ProcessAI( void )
  24. {
  25.     ProcessVision();
  26.     ProcessHearing();
  27.     TrackTarget();
  28.     UpdateMovement();
  29. }
  30.